package com.bobi.ecofavor.controller;


import com.bobi.ecofavor.common.utils.JsonResponse;
import com.bobi.ecofavor.model.domain.FuelCard;
import com.bobi.ecofavor.service.FuelCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/userOil")
public class UserOilController {
    @Autowired
    private FuelCardService fuelCardService;
/*
 * 获取用户已经绑定的卡
  * */
    @RequestMapping("/getUserCard")
    public JsonResponse userOil(Integer userId){
       List<FuelCard> fuelCard1=fuelCardService.selectUserCard(userId);
       return JsonResponse.success(fuelCard1);
    }
//绑定用户的卡
    @RequestMapping("/updateCard")
    public Integer updateCardState(FuelCard fuelCard){
       Integer updaterCount=fuelCardService.updateCardState(fuelCard);
        return updaterCount;
    }
    @RequestMapping("/rechargeCard")
    public Integer updateCardAmount(FuelCard fuelCard){
        Integer updateAmount=fuelCardService.updateCardAmount(fuelCard);
        return updateAmount;
    }

}
